package cn.zhp.mapper;

import cn.zhp.entity.Detail;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface DetailMapper extends Mapper<Detail> {
    /**
     * 根据工单id查找详单
     */
    @Select("SELECT  " +
            "    dt.*,  " +
            "    wt.CODE waste_type_code,  " +
            "    wt.NAME waste_type_name,  " +
            "    wa.CODE waste_code   " +
            "FROM  " +
            "    detail dt,  " +
            "    waste_type wt,  " +
            "    waste wa   " +
            "WHERE  " +
            "    dt.del_flag = 0   " +
            "    AND dt.work_order_id = #{oid}   " +
            "    AND dt.waste_type_id = wt.id   " +
            "    AND dt.waste_id = wa.id")
    List<Detail> selectByOid(long oid);
}